#pragma once
#include"Commd.hpp"
#include <fcntl.h>


class Client
{
  public:
  Client():_fd(gdefault)
  {}

  //打开管道以写方式
  bool OpenPipeForWrite()
  {
    _fd = OpenPipe(gWrite);
    if(_fd < 0)
    {
        return false;
    }
    return true;
  }

  //读取数据
  //参数为输出型
  int SendPipe(const std::string &in)
  {
    return ::write(_fd,in.c_str(),in.size());
  }

  //关闭管道
  void ClosePipe()
  {
    ClosePipeHelper(_fd);
  }

  ~Client()
  {}


  private:
  int _fd;
};